﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ExtBusiness;
using WF_DataAccess;
using ExtBusiness.FlowOperation;


public partial class QueryAndCollect_ExactQueryList : PageBase
{
    private string no, company, lianxiren, dianhua;

    protected void Page_Load(object sender, EventArgs e)
    {        
        no = Request["no"];
        company = Request["company"];
        lianxiren = Request["lianxiren"];
        dianhua = Request["dianhua"];
        if (no != null || company != null || lianxiren != null || dianhua != null)
        {
            if (!IsPostBack)
            {
                BindExactQueryList();
            }
        }
    }

    /// <summary>
    /// 绑定精确查询信息
    /// </summary>
    private void BindExactQueryList()
    {
        if (ViewState["dtTemp"] == null)
        {
            ClsWorkFlow clsWorkFlow = new ClsWorkFlow();
            string userflow = "";

            System.Data.DataTable dtFlowName = clsWorkFlow.GetFlowNameByUser(UserId);

            if (dtFlowName != null && dtFlowName.Rows.Count > 0)
            {
                for (int temp = 0; temp < dtFlowName.Rows.Count; temp++)
                {
                    userflow += "'" + dtFlowName.Rows[temp]["wname"].ToString().Trim() + "',";
                }
            }

            userflow = userflow.Substring(0, userflow.Length - 1);//去掉最后一个逗号

            ViewState["dtTemp"] = clsWorkFlow.GetExactQueryList(userflow);
        }
        DataTable dtTemp = ViewState["dtTemp"] as DataTable;
        gvSerial.DataSource = dtTemp;
        gvSerial.RecordCount = dtTemp.Rows.Count;
        gvSerial.DataBind();
    }


    /// <summary>
    /// 绑定数据
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gvSerial_OnLoadData(object sender, EventArgs e)
    {
        BindExactQueryList();
    }

    /// <summary>
    /// 优先级图标
    /// </summary>
    /// <param name="str"></param>
    /// <returns></returns>
    protected string Getyou(string str)
    {
        if (str.EndsWith("0"))
            str = "top_ico_yxj1.gif";
        else if (str.Equals("1"))
            str = "top_ico_yxj2.gif";
        else
            str = "top_ico_yxj3.gif";

        return str;
    }

}
